/*
 * @Descripttion: your project
 * @Author: Liujiaqing
 * @Date: 2022-02-14 11:39
 * @LastEditors: Liujiaqing
 * @LastEditTime: 2022-02-10 14:43
 */
import { Button, Form, Input } from 'antd';
import React from 'react';
import '../style.less';
interface IRightWriteInfoProps {
    onChangeOption: (value: string) => void;
}
const RightWriteInfo = (props: IRightWriteInfoProps) => {
    const { onChangeOption } = props;
    const [form] = Form.useForm();
    React.useEffect(() => {
        console.log(form);
        form.setFieldsValue({
            mobile: '',
            password: '',
        });
    }, [form]);

    const onClickSubmit = React.useCallback(() => {
        // form.submit();
        onChangeOption('success');
    }, []);
    const onFinish = React.useCallback(() => {
        // const loginForm: any = { ...form.getFieldValue([]) };
    }, [form]);
    return (
        <div className="right-content-container">
            <div className="content-title">填写资料</div>
            <Form form={form} wrapperCol={{ span: 14, offset: 0 }} layout={'vertical'} onFinish={onFinish} style={{ marginTop: '24px' }}>
                <Form.Item
                    label="设置密码："
                    name="password"
                    rules={[
                        {
                            required: true,
                            message: '密码不能为空',
                        },
                    ]}
                >
                    <Input.Password placeholder="6-16位密码，区分大小写" />
                </Form.Item>
                <Form.Item
                    label="确定密码："
                    name="passwordTwo"
                    rules={[
                        {
                            required: true,
                            message: '密码不能为空',
                        },
                    ]}
                >
                    <Input.Password placeholder="6-16位密码，区分大小写" />
                </Form.Item>
                <Form.Item
                    name="email"
                    label="邮箱："
                    rules={[
                        {
                            type: 'email',
                            message: '请输入正确的邮箱格式',
                        },
                        {
                            required: true,
                            message: '邮箱不能为空',
                        },
                    ]}
                >
                    <Input placeholder="请输入邮箱" />
                </Form.Item>
                <Form.Item name="companyName" label="公司名（选填）：">
                    <Input placeholder="请输入公司名" />
                </Form.Item>
                <Form.Item name="positionName" label="职务（选填）：">
                    <Input placeholder="请输入您的职务" />
                </Form.Item>
                <Form.Item>
                    <div className="content-flex">
                        <Button block size="middle" className="content-btn block" onClick={onChangeOption.bind(null, 'register')}>
                            上一步
                        </Button>
                        <Button type="primary" size="middle" className="content-btn" onClick={onClickSubmit}>
                            完成
                        </Button>
                    </div>
                </Form.Item>
            </Form>
        </div>
    );
};
export default RightWriteInfo;
